{% extends 'base_main.html' %}

{% block extCSS %}
    <link href="/static/css/haiersoft.css" rel="stylesheet" type="text/css" media="screen,print"/>
    <link href="/static/css/print.css" rel="stylesheet" type="text/css" media="print"/>
{% endblock %}

{% block extJS %}
    <script src="/static/js/jquery-1.10.1.min.js"></script>
    <script src="/static/js/side.js" type="text/javascript"></script>
    <script>
        $(document).ready(function () {
            $.get('/app/api/grade/',function (msg) {
                var tr_html_all = '';
                for (var i = 0; i < msg.data.results.length; i +=1){
                    var html = '';
                    html += '<tr>'
                    html += '<td>' + msg.data.results[i].id + '</td>'
                    html += '<td>' + msg.data.results[i].g_name + '</td>'
                    html += '<td>' + msg.data.results[i].g_create_time  + '</td>'
                    html += '<td><a href="/app/editorg/?grade_id='+ msg.data.results[i].id +'">编辑</a></td>'
                    tr_html_all += html
                }
                $('#grade_list').append(tr_html_all)
            });
        });




    </script>
{% endblock %}

{% block indexbody %}
    <!-- MainForm -->
<div id="MainForm">
    <div class="form_boxA" id='div_add'>
        <h2>班级信息列表</h2>
        {% csrf_token %}
        <table cellpadding="0" cellspacing="0" id="grade_list">
            <tr>
                <th>序号</th>
                <th>班级名称</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>


        </table>
        <p class="msg">共找到{{ total }}个班级记录</p>
    </div >

    <ul id="PageNum">

        <li><a href="{% url 'app:grade' %}">首页</a></li>
        {% if pages.has_previous %}
        <li><a href="{% url 'app:grade' %}?page_num={{ pages.previous_page_number }}">上一页</a></li>
        {% endif %}
        {% for i in  pages.paginator.page_range %}
        <li><a href="{% url 'app:grade' %}?page_num={{ i }}">{{ i }}</a></li>
        {% endfor %}
        {% if pages.has_next %}
        <li><a href="{% url 'app:grade' %}?page_num={{ pages.next_page_number }}">下一页</a></li>
        {% endif %}
        <li>当前{{ pages.number }}页</li>
        <li><a href="{% url 'app:grade' %}?page_num={{ pages.paginator.num_pages }}">尾页</a></li>
    </ul>

</div>

{% endblock %}
